<template>
	<div class="content">
		<div class="input size">
			<el-row class="demo-autocomplete">
				<!-- style="align-items: flex-end" -->
				<el-col :span="5" class="inpt_in">
					<el-form class="demo-form-inline">
						<el-form-item label="物品名称" :label-width="formLabelWidth">
							<el-input v-model="getLnquire.query.name" autocomplete="off" placeholder="请输入内容"></el-input>
						</el-form-item>
					</el-form>
				</el-col>
				<el-col :span="5" class="inpt_in">
					<el-form class="demo-form-inline">
						<el-form-item label="物品类型" :label-width="formLabelWidth">
							<el-select v-model="getLnquire.query.type" placeholder="下拉选择">
								<el-option key="" label="全部" value=""></el-option>
								<el-option v-for="item in lxoption" :key="item.id" :label="item.name" :value="item.id">
								</el-option>
							</el-select>
						</el-form-item>
					</el-form>
				</el-col>
				<el-col :span="5" class="inpt_in">
					<el-form class="demo-form-inline">
						<el-form-item label="网站售价" :label-width="formLabelWidth">
							<el-input v-model="getLnquire.query.minPrice" style="width: 35%;" autocomplete="off" placeholder="最小"></el-input>
							<el-input  style="width: 20%;" autocomplete="off" placeholder="——"></el-input>
							<el-input v-model="getLnquire.query.maxPrice" style="width: 35%;" autocomplete="off" placeholder="最大"></el-input>
						</el-form-item>
					</el-form>
				</el-col>
				<el-col :span="5" class="inpt_in">
					<el-form class="demo-form-inline">
						<el-form-item label="冷却时间" :label-width="formLabelWidth">
							<el-select v-model="getLnquire.query.cooling" placeholder="下拉选择">
								<el-option v-for="item in Datas" :key="item.value" :label="item.label" :value="item.value">
								</el-option>
							</el-select>
						</el-form-item>
					</el-form>
				</el-col>
				<el-col :span="5" class="inpt_in">
					<el-form class="demo-form-inline">
						<el-form-item label="发货状态" :label-width="formLabelWidth">
							<el-select v-model="getLnquire.query.state" placeholder="下拉选择">
								<el-option key="" label="全部" value=""></el-option>
								<el-option v-for="item in optionzt" :key="item.id" :label="item.name" :value="item.id">
								</el-option>
							</el-select>
						</el-form-item>
					</el-form>
				</el-col>
				<el-col :span="5" class="inpt_in">
					<el-form class="demo-form-inline">
						<el-form-item label="发货类型" :label-width="formLabelWidth">
							<el-select v-model="getLnquire.query.trade_type" placeholder="下拉选择">
								<el-option v-for="item in optionleix" :key="item.value" :label="item.label" :value="item.value">
								</el-option>
							</el-select>
						</el-form-item>
					</el-form>
				</el-col>
				<el-col :span="5" class="inpt_in">
					<el-form class="demo-form-inline">
						<el-form-item label="发货平台" :label-width="formLabelWidth">
							<el-select v-model="getLnquire.query.deliveryPlatform" placeholder="下拉选择">
								<el-option key="" label="全部" value=""></el-option>
								<el-option v-for="item in fhptoption" :key="item.id" :label="item.name" :value="item.id">
								</el-option>
							</el-select>
						</el-form-item>
					</el-form>
				</el-col>
				<el-col :span="3" class="inpt_in">
					<el-button style="width: 5vw;" type="primary" @click="clickSearch">搜索</el-button>
				</el-col>
			</el-row>
		</div>
		<div class="boder">
			<el-row>
				<el-table :data="tableData2" border style="width: 100%" :header-cell-style="{'text-align':'center','color':'rgba(0,0,0,0.85)'}"
				 stripe>
					<el-table-column fixed prop="id" label="发货id" width="160" align="center">
					</el-table-column>
					<el-table-column prop="name" label="物品名称" width="160" align="center">
					</el-table-column>
					<el-table-column prop="img" label="预览图" width="160" align="center">
					</el-table-column>
					<el-table-column prop="email" label="用户邮箱" width="160" align="center">
					</el-table-column>
					<el-table-column prop="nickname" label="用户昵称" width="160" align="center">
					</el-table-column>
					<el-table-column prop="price" label="网站售价" width="160" align="center">
					</el-table-column>
					<el-table-column prop="priceRusCost" label="采购价格" width="160" align="center">
					</el-table-column>
					<el-table-column prop="cooling" label="冷却时间" width="160" align="center">
					</el-table-column>
					<el-table-column prop="stateName" label="发货类型" width="150" align="center">
					</el-table-column>
					<el-table-column prop="deliveryPlatformName" label="发货平台" width="156.5" align="center">
					</el-table-column>
					<el-table-column prop="remarkSys" label="备注" width="160" align="center">
					</el-table-column>
				</el-table>
			</el-row>
			<el-pagination background layout="prev, pager, next,total" :page-count="getDataDelivery.pageCount" @current-change="handleCurrent">
			</el-pagination>
			<!-- 新增 -->
			<!-- <el-dialog title="新增" :visible.sync="addDialogForm">
        <addModel @fatherMethod="clickAddDialogForm"></addModel>
      </el-dialog> -->
		</div>
	</div>
</template>

<script>
	import api from '../../../api/PurchaseDelivery/index.js'
	export default {
		data() {
			return {
				input: '',
				// addModelShow: false,
				addDialogForm: false,
				getDataDelivery: {
					"currentPage": 2,
					"pageSize": 5,
					"total": 100,
					"pageCount": 0,
					"query": {
						"product_type": 2,
						"name": "",
						"type": "",
						"state": ""
					}
				},
				formLabelWidth: '6vw',
				lxoption: {}, //类型
				Datas: [{
					label: '无冷却',
					value: null
				}, {
					label: '1天',
					value: 0
				}, {
					label: '2天',
					value: 1
				}, {
					label: '3天',
					value: 2
				}, {
					label: '4天',
					value: 3
				}, {
					label: '5天',
					value: 4
				}, {
					label: '6天',
					value: 5
				}, {
					label: '7天',
					value: 6
				}], //冷却时间
				optionleix: [{
					label: '全选',
					value: null
				}, {
					label: '手动',
					value: 1
				}, {
					label: '自动',
					value: 2

				}], //发货类型
				tableData2: [],
				levalue: '',
				lenquevalue: '',
				fhztvalue: '',
				fhlxvalue: '',
				fhptoption: {},
				fhptvalue: '',
				optionzt: [],
				getLnquire: {
					"currentPage": 1,
					"pageSize": 5,
					"query": {
						"product_type": 2,
						"trade_type": null,
						"name": null,
						"type": null,
						"state": null,
						"minPrice": null,
						"maxPrice": null,
						"cooling": null,
						"deliveryPlatform": null
					}
				}

			}
		},
		created: function() {
			this.$axios.get(`${api}/gamemall/droplist/type`, {})
				.then(res => {
					this.lxoption = res.obj
				})
				.catch(err => {
					// this.$message({
					// 	message: '请求异常',
					// 	type: 'warning'
					// })
				})
			this.$axios.post(`${api}/gamemall/deliveryStatus/get`, {
					"state": 1,
					"type": 2
				})
				.then(res => {
					this.optionzt = res.data
					console.log(res)
				})
				.catch(err => {
					// this.$message({
					// 	message: '请求异常',
					// 	type: 'warning'
					// })
				})
			this.$axios.post(`${api}/gamemall/deliveryPlatform/getPlatformList`, {
					"state": 1
				})
				.then(res => {
					this.fhptoption = res.data
					console.log(this.fhptoption)

				})
				.catch(err => {
					// this.$message({
					// 	message: '请求异常',
					// 	type: 'warning'
					// })
				})
			this.clickSearch()
		},
		methods: {
			//分页查询
			search() {
				this.$axios.post(`${api}/gamemall/trade/searchListByPage`, this.getDataDelivery).then(res => {
						if (res.code == 200) {
							this.tableData2 = res.data.list;
							this.getDataDelivery.total = res.data.total;
							this.getDataDelivery.pageCount = res.data.pages;
							// this.getDataDelivery.pageCount = 0
						}
						
					})
					.catch(err => {
						
					})
			},
			//搜索
			clickSearch() {
				this.getDataDelivery.pageCount = 0
				this.$axios.post(`${api}/gamemall/trade/searchListByPage`, this.getLnquire).then(res => {
						if (res.code == 200) {
							this.tableData2 = res.data.list;
							this.getDataDelivery.total = res.data.total;
							this.getDataDelivery.pageCount = res.data.pages;
							// this.getDataDelivery.pageCount = 0
						}
						if(res.code == 500) {
							this.tableData2 = []
							this.getDataDelivery.total = 0;
							this.getDataDelivery.pageCount = 0;
						}
						
					})
					.catch(err => {
						
					})
			},
			handleCurrent(pageNumber) {
				this.getDataDelivery.currentPage = pageNumber;
				console.log(this.getDataDelivery.currentPage)
				this.search()
			}

		}
	}
</script>

<style scoped>
	.content {
		width: 99%;
		height: 99%;
		margin-left: 0.5%;
		border: 1px solid #EBEEF5;
		background-color: #FFF;
		border-radius: 0.325rem;
	}

	.inpt_in {
		margin-top: 1%;
	}

	.boder {
		width: 98%;
		height: 75%;
		border: 1px solid #EBEEF5;
		margin-top: 2%;
		margin-left: 1%;
	}

	.size {
		font-size: 0.8rem;
		color: #606266;
	}
</style>
